package com.cherrish.demo;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;

/**
 * @author cherrish
 * @time 2019-03-07 16:10
 * @name DemoWebApp
 * @desc:
 */
/*
@SpringBootApplication
public class DemoWebApp {
    public static void main(String[] args) {
        SpringApplication.run(DemoWebApp.class, args);
    }
}
*/

/**
 * 修改启动类，继承 SpringBootServletInitializer 并重写 configure 方法
 */
public class DemoWebApp extends SpringBootServletInitializer {
    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
        // 注意这里要指向原先用main方法执行的Application启动类
        return builder.sources(DemoWebApp.class);
    }
}